Component({
  properties: {
    width: {
      type: Number,
      value: 200
    },
    height: {
      type: Number,
      value: 200
    },
    text: {
      type: String,
      value: '图片'
    },
    bgColor: {
      type: String,
      value: '#f5f5f5'
    },
    textColor: {
      type: String,
      value: '#999999'
    },
    radius: {
      type: Number,
      value: 0
    },
    fontSize: {
      type: Number,
      value: 28
    }
  },
  
  data: {
    style: ''
  },
  
  attached() {
    this.updateStyle()
  },
  
  observers: {
    'width, height, bgColor, textColor, radius': function() {
      this.updateStyle()
    }
  },
  
  methods: {
    updateStyle() {
      const { width, height, bgColor, textColor, radius, fontSize } = this.properties
      const style = `width:${width}rpx;height:${height}rpx;background-color:${bgColor};color:${textColor};border-radius:${radius}rpx;font-size:${fontSize}rpx;`
      this.setData({ style })
    }
  }
}) 